<?php
  echo $this->Html->css('calendar/fullcalendar');
?>

<?php
$this->Paginator->options(array(
    'update' => '#content-outer',
    'evalScripts' => false,
    'before' => $this->Js->get('#busy-indicator')->effect('fadeIn', array('buffer' => false)),
    'complete' => $this->Js->get('#busy-indicator')->effect('fadeOut', array('buffer' => false)),
));

$pageOption = $this->Paginator->params();
?>
<?php echo $this->Html->image('loading.jpg', array('id' => 'busy-indicator', 'style' => 'display:none;')); ?>

<div id="content">
	<!--  start page-heading -->
	<div id="page-heading">
		<h1>
        <?php echo __('Manage Gift Cards'); ?>
        <?php echo $this->Html->link("Add Gift Card", array('action' => 'add'), array("class" => "button")); ?>
    </h1>

	</div>
	<!-- end page-heading -->
	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized">
        <?php echo $this->Html->image('/images/shared/side_shadowleft.jpg', array('width' => '20', 'height' => '300', 'alt' => '')); ?>
    </th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized">
        <?php echo $this->Html->image('/images/shared/side_shadowright.jpg', array('width' => '20', 'height' => '300', 'alt' => '')); ?>
    </th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td valign="top">
		<!--  start content-table-inner ...................................................................... START -->
		
			<!--  start table-content  -->

		<div id="content-table-inner">
          <?php echo $this->Session->flash(); ?>
				<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
				<tr>
                                    <th class="table-header-repeat line-left minwidth-1">
               Code
          </th>
					<th class="table-header-repeat line-left minwidth-1">
               <?php echo $this->Paginator->sort('name', 'Name'); ?>
          </th>
					<th class="table-header-repeat line-left minwidth-1">
               <?php echo $this->Paginator->sort('value', 'Value'); ?>
          </th>
					<th class="table-header-repeat line-left minwidth-1">
               <?php echo $this->Paginator->sort('expiry', 'Expire'); ?>
          </th>
					<th class="table-header-repeat line-left">
               Action
          </th>          
				</tr>

    <?php foreach ($gifts as $gift): ?>
        <tr>
            <td><?php echo $gift['Gift']['code']; ?></td>
            <td><?php echo $gift['Gift']['name']; ?></td>
            <td>
                <?php echo $this->Number->currency($gift['Gift']['value'], 'USD'); ?>
            </td>
            <td>
                <?php echo $gift['Gift']['expiry']; ?>
            </td>
            <td class="actions">
                <?php echo $this->Html->link('View', array('action' => 'view', $gift['Gift']['id'], 'admin' => true)); ?>
                <?php echo $this->Html->link('Edit', array('action' => 'edit', $gift['Gift']['id'], 'admin' => true)); ?>
                <?php echo $this->Html->link(
                          'Delete',
                          array('controller' => 'gifts', 'action' => 'delete', $gift['Gift']['id'], 'admin' => true),
                          array(),
                          "Are you sure you wish to delete this template?"
                      );
                ?>
            </td>
        </tr>
    <?php endforeach; ?>

  </table>
			<div class="clear"></div>
		<!--  start paging..................................................... -->
  <? if($pageOption['pageCount'] > 1): ?>	
    <table border="0" cellpadding="0" cellspacing="0" id="paging-table">
        <?php echo $this->element('pagination');?>       
		</table> 
		<!--  end paging................ -->
  <? endif; ?>	

		</div>
	 
			  <?php //echo $this->element("Tickets".'/listing'); ?>
      <!--  end content-table  -->
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	<div class="clear">&nbsp;</div>

</div>
<?php
    echo $this->Js->writeBuffer();
?>	
<style>
#paging-table a {
  padding: 0 12px 12px;
}
</style>
<script type="text/javascript">
  jQuery(document).ready(function() {
    jQuery("#giftsMenu").addClass("current");
  });
</script>